package org.davidliebman.android.flyer;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

public class DialogFragmentParent extends DialogFragment {

	private String mTitle = "GameOver";
	private String mMessage = "You've Finished!!";
	private String mPositive = "Play More Now.";
	private String mNegative = "Stop Game Now.";
	
	public DialogFragmentParent () {
		
	}
	
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this.getActivity());
        
        if(!mTitle.isEmpty()) {
        	alertDialogBuilder.setTitle(mTitle);
        }
        
        alertDialogBuilder.setMessage(mMessage);
        //null should be your on click listener
        
        if (!mPositive.isEmpty()) {
	        alertDialogBuilder.setPositiveButton(mPositive, new DialogInterface.OnClickListener() {
				
				@Override
				public void onClick(DialogInterface dialog, int arg1) {
					dialog.dismiss();
					doPositive();
					
				}
			});
        }
        
        if (!mNegative.isEmpty()) {
	        alertDialogBuilder.setNegativeButton(mNegative, new DialogInterface.OnClickListener() {
	
	            @Override
	            public void onClick(DialogInterface dialog, int which) {
	                dialog.dismiss();
	                doNegative();
	            }
	        });
        }


        return alertDialogBuilder.create();
    }

	public String getTitle() {
		return mTitle;
	}

	public void setTitle(String mTitle) {
		this.mTitle = mTitle;
	}

	public String getMessage() {
		return mMessage;
	}

	public void setMessage(String mMessage) {
		this.mMessage = mMessage;
	}

	public String getPositive() {
		return mPositive;
	}

	public void setPositive(String mPositive) {
		this.mPositive = mPositive;
	}

	public String getNegative() {
		return mNegative;
	}

	public void setNegative(String mNegative) {
		this.mNegative = mNegative;
	}
    public void setText(String title, String message, String positive, String negative ) {
    	this.mTitle = title;
    	this.mMessage = message;
    	this.mPositive = positive;
    	this.mNegative = negative;
    }
    
    public void doPositive() {
    	
    }
    public void doNegative() {
    	
    }
}
